package com.superhelper.common.mapper.stat;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.superhelper.common.domain.stat.StatDailyProduct;

public interface StatDailyProductMapper {

    int batchAdd(List<StatDailyProduct> stats);

    @Select("select  a.shopId,a.type as shopType, c.`name`,c.skuId,count(1) as cnt from takeout_order a,takeout_order_group b, takeout_order_group_item c "
            + " where a.id = b.orderId and b.id=c.groupId and"
            + " a.createAt >= #{startDate} and a.createAt < #{endDate} and a.`status`='settled'"
            + " and b.type = 'normal' group by a.shopId,a.type,c.skuId,c.`name`")
    List<StatDailyProduct> statDailyProduct(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

}
